﻿@model Orion.Models.Event

@{
    ViewBag.Title = "EditEvent";
    Layout = "~/Views/Shared/_WorkLayout.cshtml";
}

<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type = "text/javascript" src="@Url.Content("~/Scripts/DateTimePicker.js")"></script>

<section id="main_content_wrapper">
<h1>Breyta Atburð</h1>

@{ Html.EnableClientValidation(); }

@using (Html.BeginForm("Edit", "Event", FormMethod.Post, new { enctype = "multipart/form-data" })) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Atburður</legend>

        @Html.HiddenFor(model => model.ID)

        <div class="editor-label">
            @Html.LabelFor(model => model.Title, "Titill")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Title)
            @Html.ValidationMessageFor(model => model.Title)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.TextBody, "Lýsing")
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.TextBody)
            @Html.ValidationMessageFor(model => model.TextBody)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.EventDate, "Dagsetning atburðar")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EventDate)
            @Html.ValidationMessageFor(model => model.EventDate)
        </div>

        <div class="editor-label">
            <img id="usr_img" src="@Model.Picture" alt="@Model.Picture" />
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Picture, "Mynd")
        </div>
        <div class="editor-field">
           <input type="file" id="file" name="file" />
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UserGroup, "Sýnilegt")
        </div>
        <div class="editor-field">
            <select id="UserGroup" name="UserGroup">
                @if (@Model.UserGroup == "Allir")
                {
                    <option selected="selected" value="Allir">Allir</option>
                    <option value="Lokaður">Lokaður</option>
                }
                else
                {
                    <option value="Allir">Allir</option>
                    <option selected="selected" value="Lokaður">Lokaður</option>
                }
                
            </select>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Address, "Heimilisfang")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PostCode, "Póstnúmer")
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.PostCode, Orion.Controllers.HomeController.GetAllPostCode())
            @Html.ValidationMessageFor(model => model.PostCode)
        </div>

        <p>
            <input type="submit" value="Skrá" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

</section>